
export const useTextElement = function (editor) {

  // 文字配置
  registryComponentConfig({
    group: '可用组件', name: '文字', component: {
      code: 'text',
      previewImage: 'http://1.116.13.72/web/upload_file/20211221021814_329319b9-61c1-11ec-8add-525400138871/text.png',
      defaultData: {
        data: {
          text: '默认文本',
        },
        style: {
          display: 'inline-block',
          fontSize: '16px',
          fontWeight: '500',
          padding: '10px 20px',
          color: 'black',
        },
      },
      config: ({ registry }) => {
        registry({
          name: '文字设置',
          render: ({ editData }) => (
            <>
              <PlFormItem label="文字内容">
                <BindingEditor v-model={editData.data.text} data={editData}>
                  <PlInput v-model={editData.data.text}/>
                </BindingEditor>
              </PlFormItem>
              <PlFormItem label="文字大小"><PlInput v-model={editData.style.fontSize}/></PlFormItem>
              <PlFormItem label="文字粗细"><PlNumber v-model={editData.style.fontWeight} step={100}/></PlFormItem>
              <PlFormItem label="文字颜色"><PlColorPicker v-model={editData.style.color}/></PlFormItem>
            </>
          )
        });
      },
    }
  });
}
